package com.itheima.reggie.mapper;

import com.itheima.reggie.dto.SetmealDto;
import com.itheima.reggie.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

public interface SetmealDishMapper {
    //添加菜品
    Integer saveSetmealDish(@Param("setmealDishes") List<SetmealDish> setmealDishes);

    Integer deleteByIds(@Param("ids") Long[] ids, @Param("updateUser") Long updateUser, @Param("updateTime") LocalDateTime updateTime);

    //删除原有套餐的菜品
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    Integer deleteById(Long id);

    //根据套餐id查询套餐菜品
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> findDishById(Long setmealId);
}
